package com.test.flyweightDemo;

/**
 * ${DESCRIPTION}
 *
 * @author muxiaoyu
 * @create 2017/06/19 14:19
 **/
public class Main {
    private static final String colors[] = {"red", "green", "blue", "white", "black"};

    public static void main(String[] args) {
        for (int i = 0; i < 20; ++i) {
            Circle c = (Circle) ShapeFactory.getCircle(getRandomColor());
            c.draw();
        }
    }

    private static String getRandomColor() {
        return colors[(int) (Math.random() * colors.length)];
    }

}
